import { createBrowserRouter,Navigate } from "react-router-dom";
import { lazy,Suspense } from "react";
import Layout from "../page/layout/index";
const Home= lazy(()=>import('../page/home'))
const Manage= lazy(()=>import('../page/manage'))
const Create= lazy(()=>import('../page/Create'))
const  Content = lazy(()=>import('@/page/home/content/content'))
const router =createBrowserRouter([
    {
        path:'/',
        element:<Layout></Layout>,
        children:[
            {
                index:true,
                element:<Suspense fallback={'loading...'}><Home></Home></Suspense>
            },
            {
                path:'home',
                element:<Suspense fallback={'loading...'}><Home></Home></Suspense>,
               
            },
            {
                path:'Manage',
                element:<Suspense fallback={'loading...'}><Manage></Manage></Suspense>
            },
            {
                path:'Create',
                element:<Suspense fallback={'loading...'}><Create></Create></Suspense>
            }
        ],
    },
    //{
    //    path: "*",
    //    element: <Navigate to="/" replace={true} />, // 重定向到 /Layout
    //},
    {
        path:'/content',
        element:<Suspense fallback={'loading...'}><Content></Content></Suspense>,
    }
])

export default router